<?
	$ccom=mysql_connect($dbhost,$dbuser,$dbpass) or die("user/pass mysql incorrect");
	mysql_select_db($dbname,$ccom) or die("dbname incorrect");
	mysql_query("SET character_set_results=utf8", $ccom);
    mysql_query("set names 'utf8'",$ccom);
function stripslashes_deep($value)
{
    $value = is_array($value) ?
                array_map('stripslashes_deep', $value) :
                stripslashes($value);

    return $value;
}
function query($sql){
	return @mysql_query($sql);	
}

function insert($post,$table){
		foreach ($post as $colss => $values)
		{
			$cols[]=$colss;
			$value[]="'".mysql_real_escape_string($values)."'";
		}	
		return @mysql_query("INSERT INTO {$table} (".join(", ",$cols).") VALUES (".join(", ",$value).")");
}

function update($post,$table,$where){
		foreach ($post as $cols => $value)
		{			
			$update[]="{$cols}='".mysql_real_escape_string($value)."'";		
		}		
		$update=join(", ",$update);
		return @mysql_query("UPDATE {$table} SET {$update} WHERE $where");
}

function fetch($sql){
		return @stripslashes_deep(mysql_fetch_array($sql));
}
function numrows($sql)
{
	return @mysql_num_rows($sql);
}

function selonce($query)
{
	return fetch(query($sql));
}
function get_insert_id()
{
	return mysql_insert_id();
}

?>